<template>
	<view>
		<block v-if="isload">
			<view class="container">
				<view class="apply-list">
					<view class="apply-list-bg"></view>
					<view class="apply-list-title">已报名的聚友</view>
				</view>
				<view v-if="applylist.length > 0">
					<view class="party-itemlist" v-for="(item, index) in applylist" :key="item.id">
						<view class="party-pic">
							<image class="image" :src="item.headimg" mode="widthFix" />
						</view>
						<view class="party-info">
							<view class="p1">
								{{ item.nickname }}
								<image v-if="item.applysex == 1" :src="static_url + '/static/img/ag_team.png'"
									class="applysex"></image>
								<image v-if="item.applysex == 2" :src="static_url + '/static/img/girl.png'"
									class="applysex"></image>
								<text v-if="item.status == 0" style="color:#eb544d">待审核</text>
								<text v-if="item.status == 1">通过</text>
								<text v-if="item.status == 2" style="color:#ba1f25">拒绝</text>
							</view>
							<view class="creattime">{{ item.creattime }}</view>
						</view>

						<view class="opt">
							<view class="opt-btn btn0" v-if="item.status == 0" @click="checkapply(1, item.id)">通过</view>
							<view class="opt-btn btn1" v-if="item.status == 0" @click="checkapply(2, item.id)">拒绝</view>
							<view class="opt-btn btn2" @click="getdetail(item)">详情</view>
						</view>
					</view>
				</view>




				<view v-if="detailvisible" class="popup__container">
					<view class="popup__overlay" @tap.stop="handleClickMask"></view>
					<view class="popup__modal">
						<view class="popup__title">
							<text class="popup__title-text">报名信息</text>
							<image src="/static/img/close.png" class="popup__close" style="width:36rpx;height:36rpx"
								@tap.stop="handleClickMask" />
						</view>
						<view class="popup__content">
							<view class="d-starttime">
								<image src="../../static/img/party-user.png"></image>
								姓名：{{ detail.applyname }}
							</view>
							<view class="d-starttime">
								<image src="../../static/img/party-time.png"></image>
								手机号：{{ detail.applymobile }}
							</view>
							<view class="d-starttime">
								<image src="../../static/img/party-type.png"></image>
								性别：{{ detail.applysex == 1 ? '男' : '女' }}
							</view>
							<view class="d-starttime">
								<image src="../../static/img/party-time.png"></image>
								报名时间：{{ detail.creattime }}
							</view>

							<view class="d-starttime">
								<image src="../../static/img/party-company.png"></image>
								公司：{{ detail.company || '' }}
							</view>
							<view class="d-starttime">
								<image src="../../static/img/party-zhiwei.png"></image>
								职位：{{ detail.position || '' }}
							</view>
							<view class="d-starttime">
								<image src="../../static/img/party-ziyuan.png"></image>
								想要资源：{{ detail.want_resources || '' }}
							</view>
							<view class="d-starttime">
								<image src="../../static/img/party-ziyuan.png"></image>
								自有资源：{{ detail.own_resources || '' }}
							</view>
						</view>
					</view>
				</view>

			</view>
		</block>
		<loading v-if="loading"></loading>
		<dp-tabbar :opt="opt"></dp-tabbar>
		<popmsg ref="popmsg"></popmsg>
	</view>
</template>

<script>
var app = getApp();
export default {
	data() {
		return {
			opt: {},
			loading: false,
			isload: false,
			menuindex: -1,
			pre_url: app.globalData.pre_url, static_url: app.globalData.static_url,

			detail: [],
			datalist: [],
			pagenum: 1,
			id: 0,
			pagecontent: "",
			title: "",
			sharepic: "",
			nodata: false,
			nomore: false,

			applylist: [],
			detailvisible: false
		};
	},
	onLoad: function (opt) {
		this.opt = app.getopts(opt);
		this.getdata();
	},
	onPullDownRefresh: function () {
		this.getdata();
	},
	onShareAppMessage: function () {
		var that = this;
		return this._sharewx({
			title: this.detail.partyname,
			desc: this.detail.partyname,
			pic: this.detail.pic,
			callback: function () {
				that.sharecallback();
			}
		});
	},
	onShareTimeline: function () {
		var that = this;
		var sharewxdata = this._sharewx({
			title: this.detail.partyname,
			desc: this.detail.partyname,
			pic: this.detail.pic,
			callback: function () {

			}
		});
		var query = (sharewxdata.path).split('?')[1] + '&seetype=circle';
		return {
			title: sharewxdata.title,
			imageUrl: sharewxdata.imageUrl,
			query: query
		}
	},
	onReachBottom: function () {
		if (!this.nodata && !this.nomore && this.detail.canpl == 1) {
			this.pagenum = this.pagenum + 1
			//this.getpllist();
		}
	},
	methods: {
		getdata: function () {
			var that = this;
			var id = that.opt.id;
			that.loading = true;
			app.get('party/mypartymeber', {
				id: id
			}, function (res) {
				that.loading = false;
				that.isload = true
				that.detail = res.detail;
				that.title = res.detail.partyname;
				that.sharepic = res.detail.pic;

				that.applylist = res.applylist
				uni.setNavigationBarTitle({
					title: res.detail.partyname
				});
			});
		},
		getdetail(item) {
			this.detail = item
			this.detailvisible = true
		},
		handleClickMask() {
			this.detailvisible = false
		},
		checkapply(type, applyid) {
			let that = this
			var content = ''
			if (type == 1) {
				content = '确定通过报名吗？'
			} else {
				content = '确定拒绝报名吗？'
			}
			uni.showModal({
				title: '审核报名信息',
				content: content,
				success: function (res) {
					if (res.confirm) {
						var id = that.opt.id;
						that.loading = true;
						app.get('party/checkapply', {
							id: id,
							status: type,
							applyid: applyid
						}, function (res) {
							that.loading = false;
							that.isload = true
							that.getdata()
						});
					} else if (res.cancel) {

					}
				}
			});
		},
		makephone: function (e) {
			var that = this;
			uni.makePhoneCall({
				phoneNumber: that.detail.contractmobile,
				fail: function () { }
			});
		},
		addapply(id) {
			uni.navigateTo({
				url: "/pagesExt/party/apply?pid=" + id
			})
		}
	}
};
</script>
<style>
.header {
	background-color: #fff;
	position: relative;
	display: flex;
	flex-direction: column;
}

.d-pic image {
	width: 100%;
	height: 360rpx;
}

.header .title {
	width: 100%;
	font-size: 28rpx;
	color: #010101;
	font-weight: bold;
	padding: 20rpx 30rpx;
}

.header .artinfo {
	width: 100%;
	font-size: 28rpx;
	color: #8c8c8c;
	font-style: normal;
	overflow: hidden;
	display: flex;
	margin: 10rpx 0;
}

.header .artinfo .t1 {
	padding-right: 8rpx
}

.header .artinfo .t2 {
	color: #777;
	padding-right: 8rpx
}

.header .artinfo .t3 {
	text-align: right;
	flex: 1;
}

.header .subname {
	width: 100%;
	font-size: 28rpx;
	color: #888;
	border: 1px dotted #ddd;
	border-radius: 10rpx;
	margin: 10rpx 0;
	padding: 10rpx
}

.party-itemlist {
	display: flex;
	align-items: center;
	position: relative;
	/* margin-bottom: 12rpx; */
	padding: 20rpx 20rpx;
	background: #fff;
	border-bottom: 2rpx solid #f2f2f2;
}

.party-itemlist .party-pic {
	width: 80rpx;
	height: 80rpx;
	overflow: hidden;
	background: #ffffff;
	position: relative;
}

.party-itemlist .party-pic .image {
	width: 80rpx;
	height: 80rpx;
	border-radius: 50%;
}

.party-itemlist .party-info {
	width: 72%;
	height: auto;
	overflow: hidden;
	padding: 0 20rpx;
	display: flex;
	flex-direction: column;
	justify-content: space-between
}

.party-itemlist .party-info .p1 {
	color: #222222;
	font-weight: bold;
	font-size: 28rpx;
	line-height: 46rpx;
	display: flex;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	height: 92rpx;
	align-items: center;
}

.party-itemlist .party-info .p1 text {
	margin-left: 8rpx;
	color: #e99e44;
}

.party-itemlist .party-info .price {
	color: #eb544d;
	font-size: 28rpx;
	font-weight: bold;
}

.party-itemlist .party-info .p2 {
	display: flex;
	flex-grow: 0;
	flex-shrink: 0;
	font-size: 24rpx;
	color: #a88;
	overflow: hidden;
	padding-bottom: 6rpx
}

.party-itemlist .opt {}

.party-itemlist .opt .opt-btn {
	border-radius: 10rpx;
	border: 2rpx solid #f2f2f2;
	padding: 10rpx 16rpx;
	color: #fff
}

.party-itemlist .opt .opt-btn.btn0 {
	background: #6772FF;
}

.party-itemlist .opt .opt-btn.btn1 {
	background: #eb544d;
}

.party-itemlist .opt .opt-btn.btn2 {
	background: #e99e44;
}

.d-starttime {
	display: flex;
	align-items: center;
	padding: 12rpx 20rpx;
}

.d-starttime image {
	width: 40rpx;
	height: 40rpx;
	margin-right: 12rpx;
}

.apply-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20rpx 40rpx;
}

.apply-add {
	color: #fff;
	background: #ba1f25;
	padding: 18rpx 46rpx;
	border-radius: 38rpx;
	width: 44%;
	text-align: center;
}

.apply-view {
	color: #fff;
	background: #e99e44;
	padding: 18rpx 46rpx;
	border-radius: 38rpx;
	width: 44%;
	text-align: center;
}

.apply-list {
	background-color: #fff;
	height: 100rpx;
	line-height: 100rpx;
	padding: 0rpx 30rpx;
	margin: 20rpx 0rpx 0rpx 0rpx;
	display: flex;
	align-items: center;
}

.apply-list-bg {
	height: 42rpx;
	width: 16rpx;
	border-radius: 24rpx;
	background: #ba1f25;
	margin-right: 16rpx;
}

.apply-list-title {
	color: #010101;
	font-size: 28rpx;
	font-weight: bold;
}

.creattime {
	font-size: 24rpx;
	color: #666;
}

.applysex {
	width: 32rpx;
	height: 32rpx;
	margin-left: 12rpx;
}
</style>